package com.hetongxue.system.controller;

import com.hetongxue.response.Result;
import com.hetongxue.system.mapper.*;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description: 测试模块
 * @ClassNmae: TestController
 * @Author: 何同学
 * @DateTime: 2022-05-07 13:23
 **/
@RestController
@RequiredArgsConstructor
public class TestController {

    private final UserMapper userMapper;
    private final RoleMapper roleMapper;
    private final UserRoleMapper userRoleMapper;
    private final PermissionMapper permissionMapper;
    private final RolePermissionMapper rolePermissionMapper;

    /**
     * 获取所有用户
     **/
    @GetMapping("/getUserAll")
    public Result getUserAll() {
        return Result.Success(userMapper.selectList(null));
    }

    /**
     * 获取所有角色
     **/
    @GetMapping("/getRoleAll")
    public Result getRoleAll() {
        return Result.Success(roleMapper.selectList(null));
    }

    /**
     * 获取用户角色信息
     **/
    @GetMapping("/getUserRole")
    public Result getUserRole() {
        return Result.Success(userRoleMapper.selectList(null));
    }

    /**
     * 获取所有权限
     **/
    @GetMapping("/getPermission")
    public Result getPermission() {
        return Result.Success(permissionMapper.selectList(null));
    }

    /**
     * 获取角色权限信息
     **/
    @GetMapping("/getRolePermission")
    public Result getRolePermission() {
        return Result.Success(rolePermissionMapper.selectList(null));
    }

}
